//
//  CYDustManager.m
//  cyjf
//
//  Created by tauCross on 2017/9/6.
//  Copyright © 2017年 Auto Financing. All rights reserved.
//

#import "CYDustManager.h"



@interface CYDustManager ()

@property(nonatomic, strong)dispatch_queue_t queue;

@end


@implementation CYDustManager

+ (instancetype)standardManager
{
    static CYDustManager *manager = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        manager = [[CYDustManager alloc] init];
    });
    return manager;
}

- (instancetype)init
{
    self = [super init];
    if(self)
    {
        self.queue = dispatch_queue_create("com.cyjf.cyjf.dust", DISPATCH_QUEUE_CONCURRENT);
        dispatch_set_target_queue(self.queue, dispatch_get_global_queue(QOS_CLASS_BACKGROUND, 0));
    }
    return self;
}

#ifdef CYJF_ZHIZUN
- (void)dustMsg
{
    dispatch_async(self.queue, ^{
        //wtf
        //switch
        NSNumber *number = @0;
        switch(number.integerValue)
        {
            case 0:
                number = @(number.integerValue + 10);
                break;
            default:
                break;
        }
        DLog(@"number = %@", number);
        DLog(@"dust switch end");
    });
}

#elif defined CYJF_JICHU
- (void)dustMsg
{
    dispatch_async(self.queue, ^{
        //wtf
        //-
        NSNumber *number = @10;
        DLog(@"number = %@", number);
        DLog(@"dust - end");
    });
}

#elif defined CYJF_QIJIAN
- (void)dustMsg
{
    dispatch_async(self.queue, ^{
        //wtf
        //switch
        NSNumber *number = @0;
        switch(number.integerValue)
        {
            case 0:
                number = @(number.integerValue + 10);
                break;
            default:
                break;
        }
        DLog(@"number = %@", number);
        DLog(@"dust switch end");
    });
}

#elif defined CYJF_HUODONG
- (void)dustMsg
{
    dispatch_async(self.queue, ^{
        //wtf
        //do-while
        NSNumber *number = @0;
        do
        {
            number = @(number.integerValue + 1);
        }while(number.integerValue < 10);
        DLog(@"number = %@", number);
        DLog(@"dust do-while end");
    });
}

#elif defined CYJF_HUIKUI
- (void)dustMsg
{
    dispatch_async(self.queue, ^{
        //wtf
        //for
        NSNumber *number = @0;
        for(; number.integerValue < 10; number = @(number.integerValue + 1))
        {
            DLog(@"index:%li", number.longValue);
        }
        DLog(@"number = %@", number);
        DLog(@"dust for end");
    });
}

#elif defined CYJF_GEREN
- (void)dustMsg
{
    dispatch_async(self.queue, ^{
        //wtf
        //while
        NSNumber *number = @0;
        while(number.integerValue < 10)
        {
            number = @(number.integerValue + 1);
        }
        DLog(@"number = %@", number);
        DLog(@"dust while end");
    });
}

#else
- (void)dustMsg
{
    dispatch_async(self.queue, ^{
        //wtf
        //if
        NSNumber *number = @NO;
        if(number.boolValue)
        {
            DLog(@"number's value is YES.");
        }
        else
        {
            DLog(@"number's value is NO.");
        }
        DLog(@"dust if end");
    });
}

#endif

@end
